<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

namespace App\Http\Requests;

use App\Enums\HouseLeaseModeEnum;
use App\Enums\HouseSpecsEnum;
use App\Rules\CheckEnum;

class SetRentHouseRequest extends CommonRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'user_id' => 'required',
            'address' => 'required',
            'size' => 'required',
            'lease_mode' => ['required', new CheckEnum(new HouseLeaseModeEnum())],
            'specs' => ['required', new CheckEnum(new HouseSpecsEnum())],
            'price' => 'required',
            'house_pic' => 'required',
            'house_desc' => 'required',
            'contacts_name' => 'required',
            'contacts_phone' => 'required',
        ];
    }
}
